<?php

/**
 * verwaltung actions.
 *
 * @package    adminslittlehelper
 * @subpackage verwaltung
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 2692 2006-11-15 21:03:55Z fabien $
 */
class deleteSoftwareAction extends sfAction
{
  /**
   * Executes index action
   *
   */
  public function execute()
  {
	$c = new Criteria();
	$c->add(RechnerHasSoftwarePeer::RECHNER_ID, $this->getRequestParameter('hid'));
	$c->add(RechnerHasSoftwarePeer::SOFTWARE_ID, $this->getRequestParameter('sid'));
	
	$hardwarehassoftware = RechnerHasSoftwarePeer::doSelect($c);    
  	
	/**
	 * zugehörige Software löschen
	 */
	if(is_array($hardwarehassoftware)){
  		foreach($hardwarehassoftware as $object_value){
  			$object_value->delete();
  			$this->setFlash('errMessage', 'Daten erfolgreich gelöscht.');
  		}
	}

	return $this->redirect('management/showOverview?hid='.$this->getRequestParameter('hid').'&id='.$this->getRequestParameter('id').'&view=viewSoftware');
  }
}
